/*
 * $Id: IUserService.java 33 2007-04-22 21:36:32Z aaron.day $
 */
package org.crazydays.core;


import org.hibernate.Session;

import org.crazydays.core.data.PolisAcl;
import org.crazydays.core.data.PolisGroup;
import org.crazydays.core.data.PolisRight;
import org.crazydays.core.data.PolisUser;

/**
 * IUserService
 */
public interface IUserService
{
	/**
	 * Create a standard user. The user will have three basic acls created,
	 * a private (u+rwx), a protected (u+rwx,User g+r), and a public
	 * (u+rwx,User g+r, Guest g+r).
	 */
	public PolisUser createStandardUser(PolisUser user)
		throws DataException;

	/**
	 * Load user.
	 * 
	 * @param session Session
	 * @param name Name
	 * @return User
	 * @throws DataException
	 */
	public PolisUser loadUser(Session session, String name)
		throws DataException;

	/**
	 * Save user.
	 * 
	 * @param session Session
	 * @param user User
	 * @return User
	 * @throws DataException
	 */
	public PolisUser saveUser(Session session, PolisUser user)
		throws DataException;

	/**
	 * Delete user.
	 * 
	 * @param session Session
	 * @param user User
	 * @return User
	 * @throws DataException
	 */
	public PolisUser deleteUser(Session session, PolisUser user)
		throws DataException;

	/**
	 * Load group by name.
	 * 
	 * @param session Session
	 * @param name Name
	 * @return Group
	 * @throws DataException
	 */
	public PolisGroup loadGroup(Session session, String name)
		throws DataException;

	/**
	 * Save group.
	 * 
	 * @param session Session
	 * @param group Group
	 * @return Grouo
	 * @throws DataException
	 */
	public PolisGroup saveGroup(Session session, PolisGroup group)
		throws DataException;

	/**
	 * Delete group.
	 * 
	 * @param session Session
	 * @param group Group
	 * @return Group
	 * @throws DataException
	 */
	public PolisGroup deleteGroup(Session session, PolisGroup group)
		throws DataException;

	/**
	 * Load acl.
	 * 
	 * @param session Session
	 * @param name Name
	 * @return Acl
	 * @throws DataException
	 */
	public PolisAcl loadAcl(Session session, String name)
		throws DataException;

	/**
	 * Save acl.
	 * 
	 * @param session Session
	 * @param acl Acl
	 * @return Acl
	 * @throws DataException
	 */
	public PolisAcl saveAcl(Session session, PolisAcl acl)
		throws DataException;

	/**
	 * Delete acl.
	 * 
	 * @param session Session
	 * @param acl Acl
	 * @return Acl
	 * @throws DataException
	 */
	public PolisAcl deleteAcl(Session session, PolisAcl acl)
		throws DataException;

	/**
	 * Add right to an acl. DataException being thrown causes the
	 * transaction to be rolled back.
	 * 
	 * @param session Session
	 * @param acl Acl
	 * @param group Group
	 * @param right Right
	 * @return Acl
	 * @throws DataException
	 */
	public PolisAcl addRight(Session session, PolisAcl acl,
			PolisGroup group, PolisRight right)
		throws DataException;

	/**
	 * Delete right from an acl.
	 * 
	 * @param session Session
	 * @param acl Acl
	 * @param group Group
	 * @param right Right
	 * @return Acl
	 * @throws DataException
	 */
	public PolisAcl deleteRight(Session session, PolisAcl acl,
			PolisGroup group, PolisRight right)
		throws DataException;
}
